<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>菜鸟教程(runoob.com)</title>
		<script>
			function displayDate() {
				document.getElementById("demo").innerHTML = Date();
			}

			function changeImage(){
				element = document.getElementById('myimage')
				alert("当前元素：" + element.name)
				if(element.name.match("adv1")){
					element.src="/img/adv3.png";
				}else{
					element.src = "/img/adv4.png";
				}
			}
		</script>
	</head>
	<body>
		<h1>我的第一个 JavaScript 程序</h1>
		<p id="demo"></p>
		<button type="button" onclick="displayDate()">显示日期</button>
		<button type="button" onclick="alert('欢迎!')">点我!</button>
		<img id="myimage" name="adv1" onclick="changeImage()" src="./img/adv1.PNG" width="100" height="180">
	</body>
</html>
